<%@ page language="java"
	import="com.sql.*,com.database.*"
	pageEncoding="gb2312"%>
<%
		 
      String BranchID="";
	  String OldBranchID = (String)session.getAttribute("oldBranchID");
	  BranchID=OldBranchID;
  	if(session.getAttribute("branchid")!=null){
  		BranchID=(String)session.getAttribute("branchid");
  		}  
  					
	int i=Integer.parseInt(request.getParameter("ivalue"));
	String configid=request.getParameter("configname");
	String winID=request.getParameter("winID");
	
	out.println(i+"configid= "+configid+"   "+winID);
	String[]MQ = new String[10];
		for(int n=0;n<10;n++){
			MQ[n]="";
		}
	
	for(int m=0;m<i;m++){
	   if(request.getParameter("isAdmin"+m).equals("1")){
	      int j=Integer.parseInt(request.getParameter("winFirst"+m));
	      MQ[j]= MQ[j]+request.getParameter("wintypeID"+m)+"|";
	   }	
	}
	String sql=" insert into CQMS_Winlogic(branchid,winid,configid,Q9,Q8,Q7,Q6,Q5,Q4,Q3,Q2,Q1,Q0)";
			sql=sql+"values('"+BranchID+"',"+winID+","+configid+",'"+MQ[9]+"','"+MQ[8]+"','"+MQ[7]+"','"+MQ[6]+"','"+MQ[5]+"','"+MQ[4]+"','"+MQ[3]+"','"+MQ[2]+"','"+MQ[1]+"','"+MQ[0]+"')";
	DataBase db2=new DataBase();
	db2.executeUpdate(sql);
	db2.closeStmt();
	db2.closeConn();
		//out.println("Q9="+MQ[9]+"\t\n"+"Q8="+MQ[8]+"\t\n"+"Q7="+MQ[7]+"\t\n"+"Q6="+MQ[6]);
	response.sendRedirect("BusinessFirst.jsp");

		//response.sendRedirect("BusinessFirst.jsp");

%>
